<template>
	<div>
		<div style="float:left;">
			<Tree :data="baseData" style="width:150px" @on-select-change="onCheckChange"></Tree>
		</div>
		<Upload
		        multiple
		        type="drag"
		        name="avatar"
		        :on-success="handleSuccess"
		        action="http://localhost:3000/upload">
		        <div style="padding: 20px 0">
		            <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
		            <p>点击或将文件拖拽到这里上传</p>
		        </div>			      
		</Upload>
	</div> 
</template> 
<script>
	import Case from '../../common/Case.js'
    export default {
    	mixins:[Case],
        data () {
            return {
            	module1:"cates",
            	module3:'upload',
            	ids:[],
            	formValidate:{
                	title:"",
                	type:2,
//              	parentId:null
	            },
	             filter:{
					page:1,
					limit:2,
					name:"",
					total:0
				},
            }
        },
        methods: {
        	handleSuccess (res, file) {
        		this.getarr()
                res=Object.assign(file, {ids:this.formValidate.parentId}) 
               	console.log(res)
               if(this.formValidate.parentId!=null){
                    this.$http({
                        method:'POST',
                        url:'http://localhost:3000/upload/data',
                        data:res
                    }).then(res=>{
                    	console.log(res)
//                  	var ele=JSON.parse(res.config.data).name
//                  	console.log(ele)
//                  	this.changeType(this.formValidate.type);
////                  	console.log(JSON.parse(res.config.data).name)
//		        		this.$http({
//				        		url:'http://localhost:3000/cates/list/'+2,
//				        		method:"get"
//				        }).then(res=>{
//				        		console.log(res)
////				        		this.baseData=ele
//				        })
                    })
                }
            },
        	getarr(){
        		this.ids.forEach((element)=>{
					this.formValidate.parentId=element._id;
				})		
        	},   
        	getData(){	
				this.$http({
					method:"POST",
					url:'http://localhost:3000/upload/list',
					data:this.filter,
				})
				.then(res=>{
					this.list=res.data.rows;
					this.filter.total=res.data.total;				
				})
			},
        },
        created(){
	    	this.getTree(2)
	    }
    }
</script>
<!--<template>
	<Tree :data="baseData" style="width:300px" @on-select-change="onCheckChange"></Tree>
    <Upload
        multiple
        type="drag"
        name="avatar"
        action="http://localhost:3000/upload">
        <div style="padding: 20px 0">
            <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
            <p>点击或将文件拖拽到这里上传</p>
        </div>
      
    </Upload>
    
</template>-->
<!--<script>
	import Case from '../../common/Case.js'

    export default {
		mixins:[Case],
        data () {
            return {
            	module1:"cates"
            }
        },

    }
</script>--> 
<!--<quill-editor></quill-editor>-->
<!--//	import { quillEditor } from 'vue-quill-editor'
//      components: {
//		    quillEditor
//		  }-->